/*
 * @Author: fhw
 * @Date: 2021-11-12 10:16:13
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-02-06 15:28:08
 * @Description: 路由
 */
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import { UserOutlined, SafetyOutlined } from '@ant-design/icons-vue'
import Layout from '@/layout'
import { IconDraft, IconEditor, IconPublish, IconResume } from '@/components/icon'
export const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'Index',
		component: Layout,
		redirect: '/index',
		meta: { title: '主页', alwaysShow: true, keepAlive: true },
		children: [
			{
				path: '/index',
				name: 'Index',
				component: () => import('@/views/chat/index'),
				meta: {
					title: '主页',
				},
			},
			{
				path: '/contact',
				component: () => import('@/views/contact/index'),
				name: 'Contact',
				meta: { title: '通讯录', alwaysShow: true, keepAlive: true },
			},
			{
				path: '/article',
				component: () => import('@/views/article/index'),
				name: 'Article',
				meta: { title: '文章', alwaysShow: true, keepAlive: true },
			},
			{
				path: '/articleDetails/:id',
				component: () => import('@/views/article/components/details'),
				name: 'ArticleDetails',
				meta: { title: '文章详情', alwaysShow: true, keepAlive: false },
			},
			{
				path: '/resume',
				component: () => import('@/views/resume/index'),
				name: 'Resume',
				meta: { title: '个人简历', alwaysShow: true, keepAlive: false },
			},
			{
				path: '/editor',
				component: () => import('@/views/editor/index'),
				name: 'Editor',
				meta: {
					title: '文章编辑',
					alwaysShow: false,
					keepAlive: true,
					icon: IconEditor,
					props: {
						fontSize: 20,
					},
				},
			},
			{
				path: '/settings',
				component: () => import('@/views/settings/index'),
				name: 'Settings',
				redirect: '/settings/personalCenter',
				meta: { title: '设置', alwaysShow: true, keepAlive: true },
				children: [
					{
						path: '/settings/personalCenter',
						component: () => import('@/views/settings/components/personalCenter'),
						name: 'PersonalCenter',
						meta: {
							title: '个人中心',
							alwaysShow: true,
							keepAlive: true,
							icon: UserOutlined,
							style: {
								fontSize: '16px',
							},
						},
					},
					{
						path: '/settings/security',
						component: () => import('@/views/settings/components/security'),
						name: 'Security',
						meta: {
							title: '安全设置',
							alwaysShow: true,
							keepAlive: true,
							icon: SafetyOutlined,
							style: {
								fontSize: '18px',
							},
						},
					},
					{
						path: '/settings/publish',
						name: 'Publish',
						component: () => import('@/views/settings/components/articleManage/components/publish/index'),
						meta: { title: '发布管理', alwaysShow: true, icon: IconPublish },
					},
					{
						path: '/settings/draft',
						name: 'Draft',
						component: () => import('@/views/settings/components/articleManage/components/draft/index'),
						meta: { title: '草稿管理', alwaysShow: true, icon: IconDraft },
					},
					{
						path: '/settings/setResume',
						name: 'SettingsResume',
						component: () => import('@/views/settings/components/resume'),
						meta: {
							title: '简历管理',
							alwaysShow: true,
							icon: IconResume,
							style: {
								fill: '#000',
							},
						},
					},
				],
			},
		],
	},
	{
		path: '/login',
		component: () => import('@/views/login/index'),
		name: 'Login',
		meta: { title: '登录', alwaysShow: true, keepAlive: true },
	},
	{
		path: '/:catchAll(.*)', // 匹配不到路由,跳转404页面
		redirect: '/404',
	},
	{
		path: '/404',
		component: () => import('@/views/404/404'),
		meta: { title: '404', alwaysShow: false },
		name: 'NotFind',
	},
]

const router = createRouter({
	// mode:'hash',
	history: createWebHistory('/'),
	routes,
})
export default router
